home *** CD-ROM | disk | FTP | other *** search
- function inicializarJogo()
- {
- _root.createEmptyMovieClip("fundo2",_root.getNextHighestDepth());
- _root.createEmptyMovieClip("fundo",_root.getNextHighestDepth());
- _root.fundo2.attachMovie("fundoLonginquo","fundoLonginquo1",fundo2.getNextHighestDepth());
- _root.fundo2.attachMovie("fundoLonginquo","fundoLonginquo2",fundo2.getNextHighestDepth());
- _root.fundo.attachMovie("chao","chao1",fundo.getNextHighestDepth());
- _root.fundo.attachMovie("chao","chao2",fundo.getNextHighestDepth());
- _root.attachMovie("char","char",_root.getNextHighestDepth());
- _root.fundo.cacheAsBitmap = true;
- _root.fundo2.cacheAsBitmap = true;
- _root.char.cacheAsBitmap = true;
- _root.fundo.chao1.gotoAndStop(1);
- _root.fundo.chao2.gotoAndStop(2);
- _root.fundo2.fundoLonginquo1.gotoAndStop(1);
- _root.fundo2.fundoLonginquo2.gotoAndStop(2);
- _root.fundo2._x = 0;
- _root.fundo2._y = 0;
- _root.fundo._x = 0;
- _root.fundo._y = Stage.height;
- _root.fundo2.fundoLonginquo1._x = 0;
- _root.fundo2.fundoLonginquo1._y = 0;
- _root.fundo2.fundoLonginquo2._x = _root.fundo2.fundoLonginquo1._width;
- _root.fundo2.fundoLonginquo2._y = 0;
- _root.fundo.chao1._x = 0;
- _root.fundo.chao1._y = 0;
- _root.fundo.chao2._x = fundo.chao1._width;
- _root.fundo.chao2._y = 0;
- _root.char._xscale = char._yscale = charEscala;
- _root.char._x = Stage.width / 2;
- _root.char._y = Stage.height / 2;
- }
- function detectarTeclas()
- {
- speed *= 0.85;
- if(Key.isDown(37) && wall != "esq")
- {
- wall = "";
- if(speed > - maxMove)
- {
- speed--;
- }
- }
- else if(Key.isDown(39) && wall != "dir")
- {
- posicionarMapas();
- wall = "";
- if(speed < maxMove)
- {
- speed++;
- }
- }
- if(Key.isDown(38) && !jumping)
- {
- wall = "";
- jumping = true;
- }
- }
- function moverPersonagem()
- {
- var _loc2_ = _root.char;
- if(speed > 0)
- {
- _loc2_.play();
- _loc2_._xscale = charEscala;
- if(_loc2_._x < Stage.width / 2)
- {
- _loc2_._x += speed;
- }
- else
- {
- _loc2_._x += speed / 50;
- fundo2._x -= speed / 10;
- fundo._x -= speed;
- }
- }
- else if(speed < 0)
- {
- if(_loc2_._x <= 0)
- {
- _loc2_._x = 0;
- }
- else
- {
- _loc2_.play();
- _loc2_._xscale = - charEscala;
- _loc2_._x += speed;
- }
- }
- if(speed < 1 && speed > -1)
- {
- speed = 0;
- _loc2_.gotoAndStop(1);
- }
- }
- var speed = 0;
- var maxMove = 15;
- var jumpSpeed = -10;
- var totalMapas = 6;
- var mapaActual = 2;
- var mapaActual2 = 2;
- var charEscala = 25;
- var wall = "";
- var jumping = true;
- var falling = true;
- inicializarJogo();
- onEnterFrame = function()
- {
- detectarTeclas();
- moverPersonagem();
- };
-